feat(agent): 식 답 유형 기호 동치 검증 — '기호 검증 불가' 해소#25
Merged
Conversation
비-equation kind 중 정답이 다항식인 식 전개·간단히 유형은 verification_expression을
/evaluate로 보내도 422("not a number")로 거부돼 항상 unverified("기호 검증 불가")였다.
이제 verifyByExpression이 /evaluate의 non-numeric 422 시그널을 감지하면 원식을
선언 정답과 simplify+verify로 기호 동치 비교한다. 통과 시 passed(초록), 불일치 시
failed(numeric 경로와 대칭). 진짜 엔진 장애(타임아웃·5xx)는 시그널이 없으므로 기존대로
unverified로 남겨 일시적 장애가 reject로 이어지지 않게 했다.
프롬프트·스키마·도구 설명을 갱신해 생성기·재풀이기가 식 답일 때 정답을 베끼지 말고
전개 전 원식을 verification_expression으로 내도록 유도한다.
- sympy-verification.ts: isNonNumericEvaluateError 게이트 + symbolic 동치 폴백
- wire-adapter.ts: symbolic_check 통과 시 "검증식 기호 동치 확인" 요약
- problem-generator.md / independent-solver.md / generator-agent.ts: 식 답 원식 지시
- tests: symbolic 통과/실패/엔진장애 폴백 3개 추가 (262 pass)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 7 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
cubic 리뷰 지적(P2): isNonNumericEvaluateError가 에러 문구만 봐서 진짜 엔진 장애가 symbolic 비교로 오분류될 수 있다. /evaluate 클라이언트 에러 포맷의 "(422)" 상태코드와 "did not evaluate to a number" detail을 모두 요구하도록 강화. 둘 중 하나라도 어긋나면 보수적으로 unverified에 머문다(false-fail 방지). 422 아닌데 같은 문구를 담은 5xx도 unverified로 남는지 가드 테스트 추가. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
배경
식 전개·간단히 유형(정답이
3x+8,4x-21같은 다항식)은 결과 화면에서 항상 "기호 검증 불가" 배지가 떴다.원인: 비-equation kind의 결정론 검증 경로(
verifyByExpression)는verification_expression을 math-engine/evaluate로 보내는데,/evaluate는 변수가 든 식을422 "did not evaluate to a number"로 거부한다(math.py:557). 따라서 식 답은 평가에 실패해 항상unverified→ 배지가 떴고, 정답은 독립 재풀이로만 확인됐다.변경
/evaluate가 숫자가 아니라서 422로 거부한 경우(isNonNumericEvaluateError)를 감지하면, 원식 자체를 선언 정답과 기호 동치(simplify+verify, 기존decideAnswerEquivalence재사용)로 비교한다.unverified— 일시적 장애가 "틀린 문제"로 reject되지 않게 함생성기·재풀이기가 식 답일 때 정답을 베끼지 말고 전개 전 원식(예:
x**3 + 5*x*(x+1) - (x+4)*(x-1)*(x+2))을verification_expression으로 내도록 프롬프트·스키마·도구 설명을 갱신했다. 원식이 없으면 종전처럼 graceful하게 배지가 남아 회귀가 없다.변경 파일
steps/sympy-verification.ts— non-numeric 422 게이트 + symbolic 동치 폴백server/sse/wire-adapter.ts— symbolic 통과 시 "검증식 기호 동치 확인" 요약schemas/generated-problem.schema.ts,agents/generator-agent.ts— verification_expression 설명에 식 답 케이스 추가prompts/problem-generator.md,prompts/independent-solver.md— 식 답 원식 지시tests/sympy-verification.test.ts— symbolic 통과/실패/엔진장애 폴백 3개 추가검증
x**3 + 5*x*(x+1) - (x+4)*(x-1)*(x+2)≡3x+8,(x+5)*(x-1) - (x+2)**2 + (x-3)*4≡4x-21→ 둘 다 동치,/evaluate가 정확히 감지 대상 422 시그널을 던짐🤖 Generated with Claude Code
Summary by cubic
식 전개·간단히 유형의 식 답이
/evaluate에서 숫자가 아니라며 거부될 때, 선언 정답과의 기호 동치 비교로 검증해 "기호 검증 불가" 배지를 없앴습니다. 422가 아닌 엔진 오류는 symbolic 경로로 폴백하지 않고 그대로 unverified로 남깁니다./evaluatenon-numeric 감지 강화: HTTP 422 상태와 "did not evaluate to a number" 문구가 모두 있을 때만 symbolic 폴백(그 외는 unverified).verification_expression을 선언 정답과 simplify+verify로 기호 동치 비교(재사용:decideAnswerEquivalence) — 동치 passed, 불일치 failed. SSE 요약에 "검증식 기호 동치 확인" 추가.verification_expression으로 제출(변수 곱셈은*명시).Written for commit c22c10c. Summary will update on new commits.